import { useState, useDebugValue } from "react";

// 自定义hooks
const useCounter = (n = 1) => {
  useDebugValue("useCounter");

  const [count, setCount] = useState(n);
  const add = () => {
    setCount((count) => count + 1);
  };
  const minus = () => {
    setCount((count) => count - 1);
  };
  return [count, add, minus];
};

export default useCounter;
